/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.isd.global.dao;

import javax.ejb.Stateless;

/**
 *
 * @author Claudio
 */
@Stateless
public class CorreoElectronicoDAO extends BaseDAO {

    public int getProximoId(){

        try {
            String query = "SELECT ISNULL(MAX(USR_TVCORE_NROENV),0)+1 FROM USR_TVCORE";
            Integer proxNumero = (Integer) getEntityManager().createNativeQuery(query).getSingleResult();

            if(proxNumero==null) return 1;
            else return proxNumero;
        } catch (Exception e) {
            return 1;
        }
    }
}
